function generate_most_autodoc(install_dir)
% generate_most_autodoc - Generate the stubs and symlinks for Ref Manual.
% ::
%
%   generate_most_autodoc(install_dir)
%
% Inputs:
%   install_dir (char array) : path to the install directory for the package
%
% Creates the .rst stubs and symlinks to the source files for all functions
% and classes to be included in the Reference Manual. Creates all of the
% inputs (lists of functions and classes) to pass to generate_autodoc_stubs
% and generate_source_symlinks.

%   MOST
%   Copyright (c) 2023-2024, Power Systems Engineering Research Center (PSERC)
%   by Ray Zimmerman, PSERC Cornell
%
%   This file is part of MOST.
%   Covered by the 3-clause BSD License (see LICENSE file for details).
%   See https://github.com/MATPOWER/most for more info.

if nargin < 1
    matpower_dir = '~/dev/projects/most/';
end

sphinx_src_dir = [matpower_dir 'docs/sphinx/source/'];

lib_fcns = {
    'addgen2mpc', ...
    'addstorage', ...
    'addwind', ...
    'apply_profile', ...
    'filter_ramp_transitions', ...
    'getprofiles', ...
    'idx_profile', ...
    'loadgenericdata', ...
    'loadmd', ...
    'loadstoragedata', ...
    'loadxgendata', ...
    'md_init', ...
    'most', ...
    'most_summary', ...
    'mostver', ...
    'mpoption_info_most', ...
    'plot_gen', ...
    'plot_storage', ...
    'plot_uc', ...
    'plot_uc_data', ...
};
lib_t_fcns = {
    'c118swf', ...
    'ex_case3a', ...
    'ex_case3b', ...
    'ex_contab', ...
    'ex_load_profile', ...
    'ex_storage', ...
    'ex_transmat', ...
    'ex_wind', ...
    'ex_wind_profile', ...
    'ex_wind_profile_d', ...
    'ex_wind_uc', ...
    'ex_xgd', ...
    'ex_xgd_ramp', ...
    'ex_xgd_res', ...
    'ex_xgd_uc', ...
    'most_ex1_ed', ...
    'most_ex2_dcopf', ...
    'most_ex3_dcopf_w_uc', ...
    'most_ex4_dcopf_ss', ...
    'most_ex5_mpopf', ...
    'most_ex6_uc', ...
    'most_ex7_suc', ...
    't_case30_most', ...
    't_case3_most', ...
    't_case_tlmp', ...
    't_case_tlmp_storage', ...
    't_most_30b_1_1_0', ...
    't_most_30b_1_1_0_uc', ...
    't_most_30b_1_1_17', ...
    't_most_30b_3_1_0', ...
    't_most_30b_3_1_17', ...
    't_most_3b_1_1_0', ...
    't_most_3b_1_1_2', ...
    't_most_3b_3_1_0', ...
    't_most_3b_3_1_2', ...
    't_most_fixed_res', ...
    't_most_mpopf', ...
    't_most_sp', ...
    't_most_spuc', ...
    't_most_suc', ...
    't_most_tlmp', ...
    't_most_uc', ...
    't_most_w_ds', ...
    'test_most', ...
    'uniformwindprofile', ...
};
%     'generate_most_autodoc', ...


in = struct(...
    'function', struct(...
        'destdir', 'functions', ...
        'gh_base_url', 'https://github.com/MATPOWER/most/blob/master', ...
        'list', struct(...
            'mod', {'most', 'most'}, ...
            'src_path', {'lib', 'lib/t'}, ...
            'names', {lib_fcns, lib_t_fcns} ...
        ) ...
    ) ...
);

%% create stubs and symlinks for reference manual
generate_autodoc_stubs(in, sphinx_src_dir);
generate_source_symlinks(in, [sphinx_src_dir 'matlab-source/'], '../../../../../');
